import { read, utils } from 'xlsx';

/**
 * excel转json
 * @param data [any]
 * @example excel2json(data);
 */
export default function excel2json(data: any) {
	const wb = read(data, {
		type: 'base64'
		// type: 'binary'
	});
	return wb.SheetNames.map((sheet_name) => {
		return utils.sheet_to_json(wb.Sheets[sheet_name], {
			raw: true
		});
	});
}
